<template>
	<view class="announcement">
		<statusBar />
		<!-- 设置 -->
		<view @tap="leftIndex" class="nav">
			<image src="../../static/setup/jiantou.png" mode=""></image>
			<view>设置-店铺设置-门店公告</view>
		</view>
		<view style="padding-top: 100upx;">
			<view class="table">
				<textarea maxlength="120" placeholder="请输入公告" v-model="tkinfotest"></textarea>
				<view>{{ texsum }}/120</view>
			</view>
		</view>
		<view class="Login" @tap="modification">保存</view>
	</view>
</template>
<script>
import { mapActions, mapState } from 'vuex';
import { toast } from '@/utils/toast';
import request from '@/utils/request';
import statusBar from '../../components/statusBar/statusBar.vue';
export default {
	data() {
		return {
			tkinfotest: '', //退款说明
			texsum: 0 //退款说明长度
		};
	},
	components: {
		statusBar
	},
	onLoad(options) {
		this.tkinfotest = options.notice;
	},
	watch: {
		tkinfotest() {
			this.texsum = this.tkinfotest.length;
		}
	},
	methods: {
		// 接口
		modification() {
			uni.showLoading({
				title: '加载中',
				duration: 2000
			});

			request('/merchant/shop/store-save', 'POST', {
				notice: this.tkinfotest
			}).then(res => {
				if (res.data.code == 1) {
					console.log(res.data, 88);
					setTimeout(() => {
						uni.hideLoading();
					}, 500);
					uni.navigateTo({
						url: '/pages/Setup/Settings'
					});
				}
				
			});
		},
		leftIndex() {
			uni.navigateBack({
				delta: 1
			});
		}
	}
};
</script>
<style lang="scss" scoped>
.announcement {
	.nav {
		display: flex;
		align-items: center;
		padding: 50upx 30upx 31upx 30upx;
		background: $bg1-color;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		z-index: 9999;

		image {
			width: 27upx;
			height: 30upx;
			display: flex;
		}
		& > view {
			font-size: 34upx;
			font-family: Source Han Sans CN;
			font-weight: bold;
			color: $bg2-color;
			margin-left: 30upx;
		}
	}
	.table {
		background: #ffffff;

		padding: 44upx 25upx;
		& > view {
			font-size: 30upx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: rgba(51, 51, 51, 1);
			text-align: right;
			margin-top: -70upx;
		}
	}
	.Login {
		width: 93%;
		height: 112upx;
		margin: 0 auto;
		background: rgba(53, 57, 76, 1);
		border-radius: 56upx;
		font-size: 34upx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: $bg1-color;
		margin-top: 73upx;
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		bottom: 30upx;
		left: 0;
		right: 0;
	}
}
</style>
